// 字段显示设置
import { getSearchFormFieldsService } from '@/api/sourcing/public';
import { generateFormFieldValues } from '@sourcing/utils';
export default {
  data () {
    return {
      formLoading: false,
      formItems: [],
      formData: {},
    }
  },
  created () {
    this.getSearchFormFields().then(() => {
      this.init();
    });
  },
  methods: {
    // 获取查询条件
    async getSearchFormFields () {
      const res = await getSearchFormFieldsService(
        { menuId: this.menuId },
        state => { this.formLoading = state }
      )
      if (res) {
        const { data } = res;
        this.formItems = data;
        this.formData = generateFormFieldValues(data);
      }
    },
  }
}
